<!-- AJAX Loader //-->
<?php

if(isset($_POST["path"])) $path=$_SERVER["DOCUMENT_ROOT"].$_POST["path"];
else $path=$_SERVER["DOCUMENT_ROOT"]."/";

chdir($path);
$ignore=array(
	".",
	"..",
	"assets",
	"manager",
	"const.inc.php",
	"pre.inc.php",
	"post.inc.php"
);
$dirs=array();
$files=array();
foreach(glob("*") as $obj) {
	if(!in_array($obj, $ignore)) {
		if(is_dir($obj)) $dirs[]=$obj;
		else $files[]=$obj;
	}
}

foreach($dirs as $dir) {
	?>
<a href="#" onclick="$.vlcms.manager.siteTree.node('<?=$_POST["path"].$dir."/"?>', 'tree_<?=$dir?>');"><img src="/manager/themes/smoothness/images/tree_plus.png" alt="+" id="tree_<?=$dir?>_img" /></a><a href="#" onclick="$.vlcms.manager.loadModule('sitetree/formtree', {'path': '<?=$_POST["path"].$dir."/"?>'})"><?=$dir?></a><br/>
<div id="tree_<?=$dir?>" class="subtree"></div>
	<?
}

foreach($files as $file) {
	?>
<a href="#"><img src="/manager/themes/smoothness/images/pixel.png" alt="" /></a><a href="#"><?=$file?></a><br/>
	<?
}

?>